34. Quiz: More With Dictionaries

Context

Use the dictionary below to answer ALL of the questions regarding dictionaries. Consider you have a dictionary named animals that looks like this:

animals = {'dogs': [20, 10, 15, 8, 32, 15], 'cats': [3,4,2,8,2,4], 'rabbits': [2, 3, 3], 'fish': [0.3, 0.5, 0.8, 0.3, 1]}

Let's try a few ideas with this dictionary! If you want to try any of the code yourself, you can test it in the environment at the bottom of the page.

QUIZ QUESTION::

Question 1

Match each description to the value it describes.

ANSWER CHOICES:



Description

Value

The data type of the keys in the dictionary.

The data type of the values in the dictionary.

The result of animals['dogs'].

The result of animals['dogs'][3].

The result of animals[3]

The result of animals['fish']

SOLUTION:

Description

Value

The result of animals['dogs'].

The result of animals[3]

The result of animals[3]

The data type of the values in the dictionary.

The result of animals['dogs'][3].

The result of animals[3]

The data type of the keys in the dictionary.

The result of animals['fish']

Start Quiz:

animals = {'dogs': [20, 10, 15, 8, 32, 15], 
 'cats': [3,4,2,8,2,4], 
 'rabbits': [2, 3, 3], 
 'fish': [0.3, 0.5, 0.8, 0.3, 1]}